package com.example.yi.allWithYou;

import android.app.Application;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;

/**
 * Created by yi on 15/3/23.
 */
public class AppContext extends Application{
//    /**
//     * 用户登录
//     *
//     * @param account
//     * @param pwd
//     * @return
//     * @throws AppException
//     * @throws IOException
//     */
//    public User loginVerify(String account, String pwd) throws AppException {
//        User user = ApiClient.login(this, account, pwd);
//        if (null != user) {
//            // 保存登录用户的信息
//            saveLoginInfo(user);
//        }
//        return user;
//    }

    /**
     * 获取App安装包信息
     *
     * @return
     */
    public PackageInfo getPackageInfo() {
        PackageInfo info = null;
        try {
            info = getPackageManager().getPackageInfo(getPackageName(), 0);
        } catch (NameNotFoundException e) {
            e.printStackTrace(System.err);
        }
        if (info == null)
            info = new PackageInfo();
        return info;
    }

}
